import request from '@/api/axios.js'

export function GetCaptcha1() {
  return request({
    url: '/verify/getcode',
    method: 'post',
    responseType: 'arraybuffer' //这里特殊注明返回格式是文件流
  });
}

export function checkcode1(code) {
  return request({
    url: '/verify/checkcode',
    method: 'get',
    params: code
  })
}


export function GetCaptcha() {
  return request({
    url: '/captcha',
    method: 'post',
    responseType: 'arraybuffer' //这里特殊注明返回格式是文件流
  });
}

export function checkcode(object) {
  return request({
    url: '/login',
    method: 'post',
    params: object
  })
}

// 修改密码
export function SetUserPwd(object) {
  return request({
    url: '/admin/uppwd',
    method: 'get',
    params: object
  })
}
// ===========================管理员==============================
// 分页查询  带 账户名搜索查询
export function getPageAll(object) {
  return request({
    url: '/admin/GetPageAll',
    method: 'get',
    params: object
  })
}

// 新增管理员
export function addAdmin(object) {
  return request({
    url: '/admin/addAdmin',
    method: 'get',
    params: object
  })
}

// 修改管理员
export function updateAdmin(object) {
  return request({
    url: '/admin/updateAdmin',
    method: 'get',
    params: object
  })
}

// 删除管理员 不是真的删除 是把状态码变为false
export function deleteAdmin(object) {
  return request({
    url: '/admin/deleteAdmin',
    method: 'get',
    params: object
  })
}

// ================= 宿管接口 ============================

export function getPageDormitoryManager(object) {
  return request({
    url: '/dormitoryManager/GetPageAll',
    method: 'get',
    params: object
  })
}

//增加
export function addDorManager(object) {
  return request({
    url: '/dormitoryManager/addDorManager',
    method: 'get',
    params: object
  })
}

//修改
export function updateDorManager(object) {
  return request({
    url: '/dormitoryManager/updateDorManager',
    method: 'post',
    params: object
  })
}

//删除 修改 状态码
export function deleteDroManager(id) {
  return request({
    url: '/dormitoryManager/deleteDroManager',
    method: 'post',
    params: id
  })
}

// ============================学生===============================

//分页学生信息
export function getPageStudent(object) {
  return request({
    url: '/student/GetPageAll',
    method: 'get',
    params: object
  })
}

//增加学生信息
export function addStudent(object) {
  return request({
    url: '/student/addStudent',
    method: 'post',
    params: object
  })
}

//修改学生信息
export function updateStudent(object) {
  return request({
    url: '/student/updateStudent',
    method: 'get',
    params: object
  })
}

//修改学生信息
export function deleteStudent(id) {
  return request({
    url: '/student/deleteStudent',
    method: 'post',
    params: id
  })
}

// ==================楼宇=====================================

//分页查询楼宇带 模糊查询 楼宇名称 带精确查询楼宇名称
export function GetPageBuilding(object) {
  return request({
    url: '/building/GetPageAll',
    method: 'get',
    params: object
  })
}

//新增 楼宇
export function addBuilding(object) {
  return request({
    url: '/building/addBuilding',
    method: 'post',
    params: object
  })
}

//新增 楼宇
export function updateBuilding(object) {
  return request({
    url: '/building/updateBuilding',
    method: 'post',
    params: object
  })
}


//新增 楼宇
export function deleteBuilding(object) {
  return request({
    url: '/building/deleteBuilding',
    method: 'post',
    params: object
  })
}

//获取楼宇列表
export function BuildingList() {
  return request({
    url: '/building/BuildingList',
    method: 'post'
  })
}


// ====================================宿舍====================================

//分页查询宿舍 带 模糊查询 宿舍名称 带精确查询楼宇名称
export function GetPageAllDormitory(object) {
  return request({
    url: '/dormitory/GetPageAll',
    method: 'get',
    params: object
  })
}

//添加
export function addDormitory(object) {
  return request({
    url: '/dormitory/addDormitory',
    method: 'get',
    params: object
  })
}

//修改
export function updateDormitory(object) {
  return request({
    url: '/dormitory/updateDormitory',
    method: 'get',
    params: object
  })
}

//删除
export function deleteDormitory(object) {
  return request({
    url: '/dormitory/deleteDormitory',
    method: 'get',
    params: object
  })
}

// =========================================


//分页查询入住信息 带 模糊精确查询 宿舍名称 对应的 入住记录
export function GetPageAllLive(object) {
  return request({
    url: '/liverecord/GetPageAll',
    method: 'get',
    params: object
  })
}

//拿到未入住满人的宿舍信息
export function getdormitoryList() {
  return request({
    url: '/dormitory/getdormitoryList',
    method: 'post'
  })
}

//拿到未入住学生的学生 列表
export function getstudentList() {
  return request({
    url: '/student/getstudentList',
    method: 'post'
  })
}

//新增入住记录
export function addLive(object) {
  return request({
    url: '/liverecord/addLive',
    method: 'POST',
    params: object
  })
}

// 修改入住 信息 (换宿舍)
export function updateLive(object) {
  return request({
    url: '/liverecord/updateLive',
    method: 'POST',
    params: object
  })
}

//所有宿舍  
export function getolddormitoryList() {
  return request({
    url: '/dormitory/getolddormitoryList',
    method: 'POST'
  })
}

//所有学生
export function getoldstudentList() {
  return request({
    url: '/student/getoldstudentList',
    method: 'POST'
  })
}

export function deleteLive(id) {
  return request({
    url: '/liverecord/deleteLive',
    method: 'POST',
    params: id
  })
}

// ====================================报修======================================


//报修分页
export function GetPageAllRepair(object) {
  return request({
    url: '/repairrecord/GetPageAll',
    method: 'get',
    params: object
  })
}

export function addRepair(object) {
  return request({
    url: '/repairrecord/addRepair',
    method: 'post',
    params: object
  })
}
//处理登记
export function updateRepair(object) {
  return request({
    url: '/repairrecord/updateRepair',
    method: 'post',
    params: object
  })
}

//处理登记
export function deleteRepair(id) {
  return request({
    url: '/repairrecord/deleteRepair',
    method: 'post',
    params: id
  })
}

// ========================评分接口================================

//学生打分
export function ScoreAdd(id) {
  return request({
    url: '/scorerecord/ScoreAdd',
    method: 'post',
    params: id
  })
}

//返回宿管总人数
export function countDormitoryManager() {
  return request({
    url: '/dormitoryManager/count',
    method: 'post'
  })
}

//返回超管总人数
export function countAdmin() {
  return request({
    url: '/admin/count',
    method: 'post'
  })
}
//返回学生总人数
export function countStudnet() {
  return request({
    url: '/student/count',
    method: 'post'
  })
}

//返回各宿舍入住人数
export function countDor() {
  return request({
    url: '/dormitory/countDor',
    method: 'post'
  })
}


//返回各宿舍入住人数
export function score() {
  return request({
    url: '/scorerecord/getscore',
    method: 'post'
  })
}

//成为楼宇管理员
export function getchangeManager(object) {
  return request({
    url: '/dormitoryManager/changeManager',
    method: 'post',
    params: object
  })
}





